package com.example.transformpage.NoHttp.controlQueue;


import android.os.SystemClock;

import com.baselibrary.libs.Utils.log.LogUtils;
import com.example.transformpage.NoHttp.queue.Request;
import com.example.transformpage.NoHttp.queue.TaskExecutor;
import com.example.transformpage.NoHttp.queue.YolandaLinkedQueue;
import com.example.transformpage.NoHttp.task.NetworkInterface_plan;


/**
 * Created by Administrator 于萌萌
 * 创建日期: 17:44 . 2016年12月28日
 * 描述:
 * <p>
 * <p>
 * 备注:
 */

public class SmsQueues extends YolandaLinkedQueue<Request,Integer,Integer,DownTimer> {

    static SmsQueues sControlQueue;




    public SmsQueues(int poolSize) {
        super(poolSize);
    }
    //子线程
    @Override
    public void getData(Request request, TaskExecutor<Request, Integer, Integer, DownTimer> requestParamUpdateResultTaskExecutor, YolandaLinkedQueue<Request, Integer, Integer, DownTimer> queue) {
        long timer = request.getTimer();
            SystemClock.sleep(1*1000);
        timer-=1;
        LogUtils.i("当前线程计数"+"当前id"+request.getId()+"当前时间"+timer);
            queue.onResult(new DownTimer(request.getId(),timer));
        }

    @Override
    public void getResult(DownTimer downTimer) {
        mCallBack.onResult(downTimer);
    }

    @Override
    public void getUpData(Integer integer) {
        mCallBack.onUpData(integer);
    }




    NetworkInterface_plan mCallBack;

    public static SmsQueues getControlQueue(int poolSize){
        if (sControlQueue==null)
            return sControlQueue = new SmsQueues(poolSize);
         return sControlQueue;
        }
    public void setCallBack(NetworkInterface_plan<DownTimer,Integer> mCallBack){
        this.mCallBack= mCallBack;
    }



    @Override
    public void getParam(Integer integer) {
       // mCallBack.onParm(integer);

    }


}




